#include<stdio.h>
#include<graphics.h>
#include<conio.h>
int main()
{float PI = 3.14159;
 initgraph(800,600);//绘制窗口
 setbkcolor(RGB(128,128,128));//背景设为灰色
 cleardevice();//以背景颜色填充画布

 int centerX = 300;
 int centerY = 300;//圆心坐标
 int radius = 200;//圆半径

	 float offset;
	 float total0ffset = 0;//不同半径之间的角度偏移量
	 int i;
while(1)
{
	 for(centerY = 100; centerY < 600; centerY = centerY + 200){
		for(centerX = 100; centerX < 800; centerX = centerX + 200){
				total0ffset = 0;
				float h = rand() % 180;
				COLORREF color1 = HSVtoRGB (h, 0.9, 0.8);
				COLORREF color2 = HSVtoRGB (h+180, 0.9, 0.8);//不同颜色
					for(radius = 100; radius > 0; radius = radius - 20){
				 int left = centerX - radius;//圆外切矩形左上角x坐标
				 int right = centerX + radius;//圆外切矩形右下角x坐标
				 int bottom = centerY + radius;//圆外切矩形右下角y坐标
				 int top = centerY - radius;//圆外切矩形左上角y坐标

					for(i = 0; i < 20;i++){
						offset = i * PI / 10 + total0ffset;
						setfillcolor(color1);//随机颜色
						solidpie(left,top,right,bottom,offset,2*PI/60 + offset);//填充扇形
						setfillcolor(RGB(255,255,255));//白色
						solidpie(left,top,right,bottom,2*PI/60 + offset,3*PI/60 + offset);//填充扇形
						setfillcolor(color2);//随机颜色
						solidpie(left,top,right,bottom,3*PI/60 + offset,5*PI/60 + offset);//填充扇形
						setfillcolor(RGB(0,0,0));//黑色
						solidpie(left,top,right,bottom,5*PI/60 + offset,6*PI/60 + offset);//填充扇形
				}
					total0ffset = total0ffset + PI / 20;	
			 }			
		}
	 }
	  _getch();
}

	return 0;
}